﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;

namespace ASP_MVVC.Models;

public partial class InvoiceManagementDbContext : DbContext
{
    public InvoiceManagementDbContext()
    {
    }

    public InvoiceManagementDbContext(DbContextOptions<InvoiceManagementDbContext> options)
        : base(options)
    {
    }

    public virtual DbSet<Invoice> Invoices { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

        => optionsBuilder.UseSqlServer("Data Source=SAN-PC\\WINCCPLUSMIG2014;Initial Catalog=InvoiceManagementDB;Persist Security Info=True;User ID=sa;Password=sa;TrustServerCertificate=true");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Invoice>(entity =>
        {
            entity.Property(e => e.Amount).HasColumnType("decimal(18, 2)");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
